package edu.ccut.saturn.basevalidate.prvalidate;

import edu.ccut.saturn.component.DefaultSaturnValidate;
import edu.ccut.saturn.component.ValidateResult;

public class IsEmailValidate extends DefaultSaturnValidate {

	private static final String emailRegExpr = "^[a-zA-Z0-9][a-zA-Z0-9_\\.-]+@([0-9A-Za-z]+){1}(\\.[a-zA-Z]+){1,2}$"; 

	public void doValidate(Object value, Object[] args, ValidateResult result) {
		if (!(value.toString()).matches(emailRegExpr)) {
			sendError(_ERROR_, value, result);
		}
	}
}
